refactor(sortingrenderer): Replace custom doubly linked list with std::list in SortingNodeStruct#2810
Conversation
|
| Filename | Overview |
|---|---|
| Core/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp | Replaces DLListClass/DLNodeClass with std::list for sorted_list and clean_list; extracts insertion sort logic into Insert_To_Sorted_List; sort semantics and memory recycling are preserved, but vertex buffer assertions are inconsistently moved to debug-only in Insert_Triangles while remaining unconditional in Insert_VolumeParticle. |
| Core/Libraries/Source/WWVegas/WW3D2/sortingrenderer.h | Adds private static declaration for Insert_To_Sorted_List; no other changes, existing #pragma once and forward declarations are unaffected. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Insert_Triangles / Insert_VolumeParticle"] --> B["Get_Sorting_Struct()"]
B --> C{clean_list empty?}
C -- No --> D["pop_front() reuse node"]
C -- Yes --> E["W3DNEW SortingNodeStruct"]
D --> F["Fill node fields & transform center"]
E --> F
F --> G["Insert_To_Sorted_List(state)"]
G --> H{iterate sorted_list}
H -- "state.Z > node.Z" --> I["list::insert before node"]
H -- "end of list" --> J["push_back"]
I --> K["sorted_list (descending Z)"]
J --> K
K --> L["Flush()"]
L --> M{buffer type?}
M -- "SORTING" --> N["Insert_To_Sorting_Pool - Flush_Sorting_Pool - per-triangle sort"]
M -- "other" --> O["Draw_Triangles directly"]
N --> P["Release_Refs - clean_list.push_front"]
O --> P
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A["Insert_Triangles / Insert_VolumeParticle"] --> B["Get_Sorting_Struct()"]
B --> C{clean_list empty?}
C -- No --> D["pop_front() reuse node"]
C -- Yes --> E["W3DNEW SortingNodeStruct"]
D --> F["Fill node fields & transform center"]
E --> F
F --> G["Insert_To_Sorted_List(state)"]
G --> H{iterate sorted_list}
H -- "state.Z > node.Z" --> I["list::insert before node"]
H -- "end of list" --> J["push_back"]
I --> K["sorted_list (descending Z)"]
J --> K
K --> L["Flush()"]
L --> M{buffer type?}
M -- "SORTING" --> N["Insert_To_Sorting_Pool - Flush_Sorting_Pool - per-triangle sort"]
M -- "other" --> O["Draw_Triangles directly"]
N --> P["Release_Refs - clean_list.push_front"]
O --> P
Reviews (5): Last reviewed commit: "Add insertion to sorted list into new fu..." | Re-trigger Greptile
xezon
left a comment
There was a problem hiding this comment.
I don't see anything wrong but perhaps someone else can look over it too.
For the sorting renderer, this changes
DLListClassand its nodesDLNodeClasswith thestd::listequivalent.Tested on a custom map to verify that transparent particle rendering stays the same.
In the sorting renderer a doubly linked list is used for insertion sort in
Insert_Triangles. In a follow-up I have some code ready to optimize the insertion of particles.